package views;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.style.CharacterStyle;
import android.text.style.UnderlineSpan;
import android.widget.TextView;

import top.yunqisong.firstapp.R;

/**
 * Created by YunQisong on 2017/9/4.
 */

public class TextViewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_textview);
        TextView t1 = (TextView) findViewById(R.id.textView5);
        String s1 = "<font color='blue'><b>百度一下，你就知道~：</b></font><br>";
        s1 += "<a href = 'http://www.baidu.com'>百度</a>";
        SpannableString spannable = new SpannableString(s1);
        t1.setText(spannable);
        t1.setMovementMethod(LinkMovementMethod.getInstance());
    }
}

